package com.example.controller;
import com.example.common.Result;
import com.example.common.ResultUtils;
import com.example.exception.BusinessException;
import org.springframework.web.bind.annotation.*;
/*
@description:接口统一返回
@ClassName ResultController
@author chen
@create 2025-07-12 20:12
@Version 1.0
*/
@RestController
@RequestMapping("result")
public class ResultController
{
    @GetMapping("/hello")
    public Result<String> hello()
    {
        return  ResultUtils.success("高并发实战");
    }

    @GetMapping("/login")
    public Result<String> login(String name)
    {
        if (!"chen".equals(name))
        {
            throw new BusinessException("1001", "用户名错误");
        }
        else
        {
            return ResultUtils.success("登录成功");
        }
    }
}
